#include <pthread.h>
#include <vector>

int ticketNum = 1000;
const int threadCnt = 5;

struct ThreadInfo
{
   pthread_t _thread_id;
   int _id;
};

std::vector<ThreadInfo> Threads;

void* TryTicket(void*)
{
   while (true)
   {
      //try getting ticket...
   }
}

int main()
{
   for (int i = 0; i < threadCnt; ++i) {
      ThreadInfo th;
      th._id = i;
      pthread_create(&(th._thread_id), nullptr, TryTicket, nullptr);
      Threads.push_back(th);
   }
   for (int i = 0; i < threadCnt; ++i) {
      pthread_join(Threads[i]._thread_id, nullptr);
   }
   return 0;
}
